//
//  RW_ItemCollectionViewCell.m
//  SleepApp
//
//  Created by MAC on 2021/4/7.
//  Copyright © 2021 RiceWang. All rights reserved.
//

#import "RW_ItemCollectionViewCell.h"
@interface RW_ItemCollectionViewCell ()
@property (nonatomic,strong) UILabel *title_label;
@property (nonatomic,strong) UIImageView *icon_image_view;

@end
@implementation RW_ItemCollectionViewCell
-(void)bind_row_data:(WLBaseCollectionViewLayerRow *)sender{
    if ([sender.data isKindOfClass:RW_ItemCollectionViewCellModel.class]){
        RW_ItemCollectionViewCellModel *model = sender.data;
        self.title_label.text = model.title_string;
    }
}
-(void)bind_delegate:(id)sender{
    
}


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = UIColor.whiteColor;
        self.layer.cornerRadius = 4;
        [self addSubview:self.title_label];
        [self addSubview:self.icon_image_view];
        [self.title_label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self);
            make.left.mas_equalTo(self).mas_offset(10);
        }];
        [self.icon_image_view mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self);
            make.right.mas_equalTo(self).mas_offset(-10);
        }];
    }
    return self;
}

-(UILabel *)title_label{
    if (!_title_label){
        _title_label = [[UILabel alloc]init];
        _title_label.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
        _title_label.textColor = HexColor(@"444444");
    }
    return _title_label;
}
-(UIImageView *)icon_image_view{
    if (!_icon_image_view){
        _icon_image_view = [[UIImageView alloc]init];
    }
    return _icon_image_view;
}
@end


@implementation RW_ItemCollectionViewCellModel
-(NSString *)title_string{
    if (!_title_string){
        switch (self.item_type) {
            case Mine_Item_Type_Feedback:
                _title_string = @"意见反馈";
                break;
            case Mine_Item_Type_PlayerClass:
                _title_string = @"默认播放器";
                break;
            case Mine_Item_Type_Purchase:
                _title_string = @"付费内容开通";
                break;
            case Mine_Item_Type_Statement:
                _title_string = @"内容版权";
                break;
            default:
                _title_string = @"未知功能";
                break;
        }
    }
    return _title_string;
}
@end
